package main

import (
	"fmt"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
)

func GetPathWindows() string {
	file, _ := exec.LookPath(os.Args[0])
	path, _ := filepath.Abs(file)
	splist := strings.Split(path, "\\")
	size := len(splist)
	splist = strings.Split(path, splist[size-1])
	ret := strings.Replace(splist[0], "\\", "\\", size-1)
	return ret
}

//copy例子
//c := exec.Command("cmd.exe", "/c", "copy", "*.txt", "..\\b\\")

func main() {
	path := GetPathWindows()
	c := exec.Command("cmd.exe", "/c", "copy", "*.txt", "..\\b\\")
	c.Stdout = os.Stdout
	c.Run()

	fmt.Println("结束", path)
}
